#include<cstdio>
#include<string>
#include<stack>
#include<iostream>
using namespace std;
int main()
{
	int n;
	int a[10000];
	string s1,s2;
	while(cin>>n)
	{
		cin>>s1>>s2;
		stack<char> st;
		int i=0,j=0,in=0,t=0,out=0;
		//st.push(s1[0]);
		while(1)
		{
			st.push(s1[i]);
			in++;
			a[++t]=1;
			while(!st.empty()&&s2[j]==st.top())
			{
				j++;
				st.pop();
				out++;
				a[++t]=0;
			}
			i++;
			if(in==n)break;
		}
		if(out!=n)printf("No.\n");
		else
		{
			printf("Yes.\n");
			for(int i=1;i<=2*n;i++)
				if(a[i])printf("in\n");
				else printf("out\n");
		}
		printf("FINISH\n");
	}
	return 0;
}
			




	
